import * as PIXI from "pixi.js";
export default class GroundSprite {
  constructor(app) {
    this.groundTexture1 = PIXI.Texture.from(
      "/public/map/PNG/game_background_1/game_background_1.png"
    );
    this.groundTexture2 = PIXI.Texture.from(
      "/public/map/PNG/game_background_2/game_background_2.png"
    );
    this.groundTexture3 = PIXI.Texture.from(
      "/public/map/PNG/game_background_3/game_background_3.png"
    );
    this.groundTexture4 = PIXI.Texture.from(
      "/public/map/PNG/game_background_4/game_background_4.png"
    );
    this.container = new PIXI.TilingSprite(
      this.groundTexture1,
      app.screen.width,
      app.screen.height
    );
    this.container.tileScale.x = 0.5;
    this.container.tileScale.y = 0.5;
    this.index = 1;
  }
  switchMap() {
    this.index += 1;
    if (this.index == 1) {
      this.container.texture = this.groundTexture1;
    } else if (this.index == 2) {
      this.container.texture = this.groundTexture3;
    } else if (this.index == 3) {
      this.container.texture = this.groundTexture4;
    } else if (this.index == 4) {
      this.container.texture = this.groundTexture2;
    }
  }
}
